#
# Makefile
#
# Makefile for turtlebot
include ../../config.mak

CFLAGS += -I./ -I../ -I/usr/include/ni -DDEBUG_BUILD

LFLAGS  += -Wall -shared -fPIC

#SOURCES	= MF_And_Server.c camera.c overlay2.c yuv2jpg.c 
SOURCESC	= turtlebot.c output_http.c httpd.c
SOURCESCPP	= input_kinect.cpp jpeg_utils.cpp
OBJECTS	= ${SOURCESC:.c=.o} ${SOURCESCPP:.cpp=.o}

#OUT	= linux.so
OUT	= target.a
LIBS = -lpthread

all: $(OUT)
	@echo Build DONE.

.c.o:
	$(CC) -c $(CFLAGS) $(OPTFLAGS) -o $@ $<

.cpp.o:
	$(CXX) -c $(CFLAGS) $(OPTFLAGS) -o $@ $<

$(OUT): $(OBJECTS)
	$(AR) rcs $(OUT) $(OBJECTS)
#	$(CC) $(LFLAGS) -o $(OUT) $(OBJECTS) $(LIBS)

kinecttest: kinecttest.o jpeg_utils.o
	$(CXX) $(LDFLAGS) -o $@ $^ -ljpeg -lOpenNI -lusb-1.0

roombatest: roombatest.o
	$(CC) $(LDFLAGS) -o $@ $<

clean:
	rm -f $(OBJECTS) kinecttest.o roombatest.o $(OUT)
